#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 3e4 + 10;

int a[N];
int n, w;
int main()
{
	cin >> w >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1);
	int left = 1, right = n, cnt = 0;
	while (left <= right)
	{
		if (a[left] + a[right] > w)
			cnt++, right--;
		else
			cnt++,left++, right--;
	}
	cout << cnt << endl;
	return 0;
}